 {
        
        var o = require("./SafeLoader"), i = null;

        function a(e) {
            var t = "resources/sound/" + e + ".mp3";
            return cc.url.raw(t);
        }

        var r = {
            w1tiao: ["w1tiao_1", "w1tiao_2", "w1tiao_3"],
            w2tiao: ["w2tiao_1", "w2tiao_2"],
            w3tiao: ["w3tiao_1", "w3tiao_2"],
            w4tiao: ["w4tiao_1", "w4tiao_2"],
            w5tiao: ["w5tiao_1", "w5tiao_2"],
            w6tiao: ["w6tiao_1", "w6tiao_2"],
            w7tiao: ["w7tiao_1", "w7tiao_2"],
            w8tiao: ["w8tiao_1", "w8tiao_2", "w8tiao_3"],
            w9tiao: ["w9tiao_1", "w9tiao_2"],
            w1wan: ["w1wan_1", "w1wan_2"],
            w2wan: ["w2wan_1", "w2wan_2"],
            w3wan: ["w3wan_1", "w3wan_2"],
            w4wan: ["w4wan_1", "w4wan_2"],
            w5wan: ["w5wan_1"],
            w6wan: ["w6wan_1"],
            w7wan: ["w7wan_1", "w7wan_2"],
            w8wan: ["w8wan_1"],
            w9wan: ["w9wan_1", "w9wan_2"],
            w1tong: ["w1tong_1", "w1tong_2"],
            w2tong: ["w2tong_1", "w2tong_2"],
            w3tong: ["w3tong_1", "w3tong_2", "w3tong_3"],
            w4tong: ["w4tong_1", "w4tong_2"],
            w5tong: ["w5tong_1", "w5tong_2"],
            w6tong: ["w6tong_1", "w6tong_2"],
            w7tong: ["w7tong_1", "w7tong_2"],
            w8tong: ["w8tong_1", "w8tong_2"],
            w9tong: ["w9tong_1", "w9tong_2"],
            wgang: ["wgang_1"],
            wangang: ["wgang_an_1"],
            whu: ["whu_1"],
            wpeng: ["wpeng_1", "wpeng_2", "wpeng_3"],
            wzimo: ["wzimo_1", "wzimo_2"],
            m1tiao: ["m1tiao_1", "m1tiao_2"],
            m2tiao: ["m2tiao_1", "m2tiao_2"],
            m3tiao: ["m3tiao_1", "m3tiao_2"],
            m4tiao: ["m4tiao_1", "m4tiao_2"],
            m5tiao: ["m5tiao_1", "m5tiao_2"],
            m6tiao: ["m6tiao_1", "m6tiao_2"],
            m7tiao: ["m7tiao_1", "m7tiao_2"],
            m8tiao: ["m8tiao_1", "m8tiao_2", "m8tiao_3"],
            m9tiao: ["m9tiao_1", "m9tiao_2"],
            m1wan: ["m1wan_1", "m1wan_2"],
            m2wan: ["m2wan_1", "m2wan_2"],
            m3wan: ["m3wan_1", "m3wan_2"],
            m4wan: ["m4wan_1", "m4wan_2"],
            m5wan: ["m5wan_1"],
            m6wan: ["m6wan_1"],
            m7wan: ["m7wan_1", "m7wan_2"],
            m8wan: ["m8wan_1"],
            m9wan: ["m9wan_1", "m9wan_2"],
            m1tong: ["m1tong_1", "m1tong_2"],
            m2tong: ["m2tong_1", "m2tong_2"],
            m3tong: ["m3tong_1", "m3tong_2", "m3tong_3"],
            m4tong: ["m4tong_1", "m4tong_2", "m4tong_3"],
            m5tong: ["m5tong_1", "m5tong_2"],
            m6tong: ["m6tong_1", "m6tong_2"],
            m7tong: ["m7tong_1", "m7tong_2"],
            m8tong: ["m8tong_1", "m8tong_2", "m8tong_3"],
            m9tong: ["m9tong_1", "m9tong_2"],
            mgang: ["mgang_ming_1"],
            mangang: ["mgang_an_1", "mgang_an_2"],
            mhu: ["mhu_1"],
            mpeng: ["mpeng_1", "mpeng_2", "mpeng_3", "mpeng_4"],
            mzimo: ["mzimo_1", "mzimo_2"]
        }, s = {
            w1tiao: ["w1tiao"],
            w2tiao: ["w2tiao"],
            w3tiao: ["w3tiao"],
            w4tiao: ["w4tiao"],
            w5tiao: ["w5tiao"],
            w6tiao: ["w6tiao"],
            w7tiao: ["w7tiao"],
            w8tiao: ["w8tiao"],
            w9tiao: ["w9tiao"],
            w1wan: ["w1wan"],
            w2wan: ["w2wan"],
            w3wan: ["w3wan"],
            w4wan: ["w4wan"],
            w5wan: ["w5wan"],
            w6wan: ["w6wan"],
            w7wan: ["w7wan"],
            w8wan: ["w8wan"],
            w9wan: ["w9wan"],
            w1tong: ["w1tong"],
            w2tong: ["w2tong"],
            w3tong: ["w3tong"],
            w4tong: ["w4tong"],
            w5tong: ["w5tong"],
            w6tong: ["w6tong"],
            w7tong: ["w7tong"],
            w8tong: ["w8tong"],
            w9tong: ["w9tong"],
            wchi: ["wchi"],
            wting: ["wting"],
            wgang: ["wgang"],
            wangang: ["wgang"],
            whu: ["whu"],
            wpeng: ["wpeng"],
            wzimo: ["wzimo"],
            m1tiao: ["m1tiao"],
            m2tiao: ["m2tiao"],
            m3tiao: ["m3tiao"],
            m4tiao: ["m4tiao"],
            m5tiao: ["m5tiao"],
            m6tiao: ["m6tiao"],
            m7tiao: ["m7tiao"],
            m8tiao: ["m8tiao"],
            m9tiao: ["m9tiao"],
            m1wan: ["m1wan"],
            m2wan: ["m2wan"],
            m3wan: ["m3wan"],
            m4wan: ["m4wan"],
            m5wan: ["m5wan"],
            m6wan: ["m6wan"],
            m7wan: ["m7wan"],
            m8wan: ["m8wan"],
            m9wan: ["m9wan"],
            m1tong: ["m1tong"],
            m2tong: ["m2tong"],
            m3tong: ["m3tong"],
            m4tong: ["m4tong"],
            m5tong: ["m5tong"],
            m6tong: ["m6tong"],
            m7tong: ["m7tong"],
            m8tong: ["m8tong"],
            m9tong: ["m9tong"],
            mchi: ["mchi"],
            mting: ["mting"],
            mgang: ["mgang"],
            mangang: ["mgang"],
            mhu: ["mhu"],
            mpeng: ["mpeng"],
            mzimo: ["mzimo"],
            w31: ["w31"],
            w32: ["w32"],
            w33: ["w33"],
            w34: ["w34"],
            w35: ["w35"],
            w36: ["w36"],
            w37: ["w37"],
            m31: ["m31"],
            m32: ["m32"],
            m33: ["m33"],
            m34: ["m34"],
            m35: ["m35"],
            m36: ["m36"],
            m37: ["m37"]
        }, l = {
            _soundType: 0,
            setSoundType: function (e) {
                this._soundType = e;
            },
            getSoundType: function () {
                return this._soundType;
            },
            preload: function (e, t) {
                (0, o.safeLoad)(e, t);
            },
            canPlayEffect: function () {
                return !(!Global.userProfile.profile.ALLOW_SOUND_EFFECT || Global._isInBackground);
            },
            canPlayMusic: function () {
                return !(!Global.userProfile.profile.ALLOW_SOUND_MUSIC || Global._isInBackground);
            },
            playEffect: function (e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
                if (!this.canPlayEffect()) {
                    return null;
                }
                var n = "Effect/", o = a(n += e);
                this.preload(o, function (e, n) {
                    if (!e) {
                        return cc.audioEngine.play(o, t);
                    }
                    console.log("playEffect error");
                });
            },
            playEmojiChat: function (e) {
                if (this.canPlayEffect()) {
                    var t = "Chat/Interactions/", n = a(t += e);
                    return cc.audioEngine.play(n, !1);
                }
            },
            playSCMJChat: function (e, t) {
                if (e %= 2, this.canPlayEffect()) {
                    var n = "Chat/";
                    n += 1 === e ? "woman/" : "man/";
                    var o = a(n += t);
                    this.preload(o, function (e, t) {
                        return e ? -1 : cc.audioEngine.play(o, !1);
                    });
                }
            },
            playStartGameEffect: function () {
                this.playEffect("start");
            },
            playCrashEffect: function () {
                this.playEffect("down");
            },
            playDiceEffect: function () {
                this.playEffect("dice");
            },
            playDoAbsenceEffect: function () {
                this.playEffect("absence");
            },
            playSendTileEffect: function () {
                this.playEffect("sendtile");
            },
            playTileSelectSound: function () {
                this.playEffect("select");
            },
            playTileDrawTileSound: function () {
                this.playEffect("receive");
            },
            playAlarm: function () {
                this.playEffect("alarm");
            },
            playGameEnd: function () {
                this.playEffect("js_y");
            },
            playTingSound: function (e) {
                this.playSoundWithSex(e, "ting.mp3");
            },
            playWinSound: function (e) {
                this.playSoundWithSex(e, "hu.mp3");
            },
            playEatSound: function (e) {
                this.playSoundWithSex(e, "chi.mp3");
            },
            playPengSound: function (e) {
                this.playSoundWithSex(e, "peng.mp3");
            },
            playBrightBarSound: function (e) {
                this.playSoundWithSex(e, "gang.mp3");
            },
            playDarkBarSound: function (e) {
                this.playSoundWithSex(e, "angang.mp3");
            },
            playWinBySelfSound: function (e) {
                this.playSoundWithSex(e, "zimo.mp3");
            },
            playScoreSound: function () {
                this.playEffect("add_score");
            },
            playTileSound: function (e, t, n) {
                var o = "";
                e < 10 ? o = e + "wan.mp3" : e < 20 ? o = e % 10 + "tong.mp3" : e < 30 ? o = e % 10 + "tiao.mp3" : e > 30 && (o = e + ".mp3"),
                    this.playSoundWithSex(t, o, n);
            },
            playReward: function (e) {
                this.playEffect("get_coins");
            },
            playSoundWithSex: function (e, t) {
                if (0 != this.canPlayEffect()) {
                    var n = this.getSoundType(), o = "", i = t.indexOf(".mp3");
                    t = t.substring(0, i), t = e == Global.config.sex.Boy ? "m" + t : "w" + t;
                    var l = e == Global.config.sex.Boy ? "Man" : "Woman", c = null;
                    if (0 == n ? (o = "sichuan", (c = r[t]) || (c = s[t], o = "normal")) : 1 == n && (o = "normal",
                    (c = s[t]) || (c = r[t], o = "sichuan")), null != c) {
                        var d = c.length;
                        if (d > 0) {
                            var u = a(l + "/" + o + "/" + c[Math.floor(Math.random() * d)]);
                            this.playEffect2(u);
                        }
                    }
                }
            },
            playEffect2: function (e) {
                this.preload(e, function (t, n) {
                    return t ? -1 : cc.audioEngine.play(e, !1);
                });
            },
            stopEffect: function (e) {
                e > -1 && cc.audioEngine.stop(e);
            },
            playMusic: function (e) {
                var t = this, n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], o = a(e);
                return i === o && this.isMusicPlaying() ? null : this.canPlayMusic() ? void (o && this.preload(o, function (e, a) {
                    if (!e) return i = o, t.stopMusic(t.bgmId), t.bgmId = cc.audioEngine.playEffect(o, n),
                        t.bgmId;
                })) : null;
            },
            stopBGM: function () {
                this.bgmId > -1 && cc.audioEngine.stop(this.bgmId);
            },
            stopMusic: function (e) {
                e > -1 && cc.audioEngine.stop(e);
            },
            pauseMusic: function (e) {
                e > -1 && cc.audioEngine.pause(e);
            },
            resumeMusic: function (e) {
                e > -1 && cc.audioEngine.resume(e);
            },
            isMusicPlaying: function () {
                return this.bgmId > -1 ? 1 == this.getAudioState(this.bgmId) : null;
            },
            getAudioState: function (e) {
                var t = -1;
                if (e <= -1) return t;
                var n = cc.audioEngine.getState(e);
                switch (console.log("onAudioState:", n), n) {
                    case cc.audioEngine.AudioState.ERROR:
                        console.log("onAudioState ERROR", e), t = -1;
                        break;

                    case cc.audioEngine.AudioState.INITIALZING:
                        console.log("onAudioState INITIALZING", e), t = 0;
                        break;

                    case cc.audioEngine.AudioState.PLAYING:
                        console.log("onAudioState PLAYING", e), t = 1;
                        break;

                    case cc.audioEngine.AudioState.PAUSED:
                        console.log("onAudioState PAUSED", e), t = 2;
                }
                return t;
            }
        };
         module.exports = l
    }